#/etc/bash

echo "This will create a user..."
echo "Requires four parameters..."
echo "1. Account Name - This is the account name required for login on the front page"
echo "2. Realm Name   - this is the URL that will be managed"
echo "3. Login Name   - this is the user's Login Name from the home screen"
echo "4. Password     - plain text password for the user"



ACCOUNTNAME="$1"
SOMEREALM="$2"
LOGINNAME="$3"
PASSWORD="$4"

echo " "
echo " "
echo "ACCOUNTNAME = $ACCOUNTNAME"
echo "SOMEREALM   = $SOMEREALM"
echo "LOGINNAME   = $LOGINNAME"
echo "PASSWORD    = $PASSWORD"

echo " "
echo " Looks good?  if so, then you must enter a single 'y' to continue"
read line

if [ "${line}" == "y" ] 
then


cmd="/opt/kazoo/utils/sup/sup crossbar_maintenance create_account $ACCOUNTNAME $SOMEREALM $LOGINNAME $PASSWORD"

	echo "Executing..."
	echo $cmd

	$cmd

else
	echo "   >>> you entered ${line} which is invalid "
fi

